
<?
//传递产品的id，然后根据产品id，查出其所属分类的名字。
//为了输出格式的灵活，所以第二个参数$termnumber用来判断返回term0~term5

//传递产品的id，查出term0至term5个个分类的名字和id
function gettermdate($dataid,$termnumber)
{

global $table_Prefix;
//设置需要搜索的表格的前缀后缀
$table_Suffix="login_admin";
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀


//设置需要搜索的表格的排序项和升降项
$sort_by = "nid";
$sort_order = "desc";
//设置需要搜索的表格的排序项和升降项


$result = mysql_query("SELECT * FROM $table where nid = '$dataid'");//	查出这个id的产品的各个termid
	
while($row = mysql_fetch_array($result))
  {

  $term0=$row['term0'];
  $term1=$row['term1'];
  $term2=$row['term2'];
  $term3=$row['term3'];
  $term4=$row['term4'];
  $term5=$row['term5'];
  
  
  }
  
  
//	根据这些term的id查出各自的名字

global $table_Prefix;
//设置需要搜索的表格的前缀后缀
$table_Suffix="login_admin_term";
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀


$result = mysql_query("SELECT * FROM $table where nid = '$term0'");
	
while($row = mysql_fetch_array($result))
  {
  $term0_name=$row['name'];
  }
  
  

$result = mysql_query("SELECT * FROM $table where nid = '$term1'");
	
while($row = mysql_fetch_array($result))
  {
  $term1_name=$row['name'];
  }  
  
  

$result = mysql_query("SELECT * FROM $table where nid = '$term2'");
	
while($row = mysql_fetch_array($result))
  {
  $term2_name=$row['name'];
  }
  

$result = mysql_query("SELECT * FROM $table where nid = '$term3'");
	
while($row = mysql_fetch_array($result))
  {
  $term3_name=$row['name'];
  }
  

$result = mysql_query("SELECT * FROM $table where nid = '$term4'");
	
while($row = mysql_fetch_array($result))
  {
  $term4_name=$row['name'];
  } 
  

$result = mysql_query("SELECT * FROM $table where nid = '$term5'");
	
while($row = mysql_fetch_array($result))
  {
  $term5_name=$row['name'];
  } 
  	
mysql_close($con);


if($termnumber==1)
{return $term1_name;}

else if($termnumber==2)

{return $term2_name;}

else if($termnumber==3)
{return $term3_name;}

elseif($termnumber==4)
{return $term4_name;}

else// if($termnumber==5)
{return $term5_name;}
	
//	查出t1直到t5的名字，然后输出


 
}








function check_admin_type()
{
 

//根据传过来的session账户名，确定账户的类型，从而判断权限

global $table_Prefix;
//设置需要搜索的表格的前缀后缀
$table_Suffix="login_admin";
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀


//设置需要搜索的表格的排序项和升降项
$sort_by = "nid";
$sort_order = "desc";
//设置需要搜索的表格的排序项



$check_name=$_SESSION['username'] ;

$result = mysql_query("select * from $table where name = '$check_name' ");
	
while($row = mysql_fetch_array($result))
  {
  $admin_nid=$row['nid'];
  $admin_type_now=$row['admin_term'];
  $admin_password=$row['admin_password'];
  }
 

  
if($admin_type_now==1)
{
	return "admins";
	}
	
elseif($admin_type_now==2)
{
	return "editor";
	}

}



?>


<?
//获取指定板块的伪静态url================

function menu_url($str)
{
    global $table_Prefix;
    global $sys_list_table;
    global $sys_term_table;
    global $sys_plate_table;
//设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_plate_table;
    $table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀

    $result = mysql_query("SELECT * FROM $table where mid = '$str' ");

    while ($row = mysql_fetch_array($result)) {
        $url = $row['url'];
    }

    return $url;

}



//获取指定板块的名称
function menu_name($str)
{
    global $table_Prefix;
    global $sys_plate_table;
//设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_plate_table;
    $table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀

    $result = mysql_query("SELECT * FROM $table where mid = '$str' ");

    while ($row = mysql_fetch_array($result)) {
        $name = $row['name'];
    }

    return $name;

}


//获取指定板块的名称
function menu_title($str)
{
    global $table_Prefix;
    global $sys_plate_table;
    $table_Suffix = $sys_plate_table;
    $table = $table_Prefix . $table_Suffix;

    $result = mysql_query("SELECT * FROM $table where mid = '$str' ");

    while ($row = mysql_fetch_array($result)) {
        $title = $row['title'];
    }

    return $title;

}


//获取指定板块的名称
function menu_term($str)
{
    global $table_Prefix;
    global $sys_plate_table;
//设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_plate_table;
    $table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀

    $result = mysql_query("SELECT * FROM $table where mid = '$str' ");

    while ($row = mysql_fetch_array($result)) {
        $term = $row['term'];
    }

    return $term;

}


//获取指定板块的名称
function menu_page_list($str)
{
    global $table_Prefix;
    global $sys_plate_table;
//设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_plate_table;
    $table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀

    $result = mysql_query("SELECT * FROM $table where mid = '$str' ");

    while ($row = mysql_fetch_array($result)) {
        $page_list = $row['page_list_num'];
    }

    return $page_list;

}


//获取指定板块的名称
function menu_term_publish($str)
{
    global $table_Prefix;
    global $sys_plate_table;
//设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_plate_table;
    $table = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀

    $result = mysql_query("SELECT * FROM $table where mid = '$str' ");

    while ($row = mysql_fetch_array($result)) {
        $term_publish = $row['term_public'];
    }

    return $term_publish;

}



// 1. 生成原始的二维码(生成图片文件)
/*function scerweima($url=''){
  require_once ROOT_PATH.'/application/phpqrcode/phpqrcode.php';
  $value = $url;         //二维码内容
  $errorCorrectionLevel = 'L';  //容错级别
  $matrixPointSize = 5;      //生成图片大小
  //生成二维码图片
  $filename = ROOT_PATH.'qrcode/'.microtime().'.png';
  QRcode::png($value,$filename , $errorCorrectionLevel, $matrixPointSize, 2);
  $QR = $filename;        //已经生成的原始二维码图片文件
  $QR = imagecreatefromstring(file_get_contents($QR));
  //输出图片
  imagepng($QR, 'qrcode.png');
  imagedestroy($QR);
  return '<img src="'.ROOT_PATH.'qrcode.png" alt="使用微信扫描支付">';
}*/

?>